﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;

namespace TrafficTechFormsHistory.ManagersSubmittedFormsCount
{
    public partial class ManagersSubmittedFormsCountUserControl : UserControl
    {
        HelperManager obj = new HelperManager();
        protected void Page_Load(object sender, EventArgs e)
        {


            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                try
                {
                    obj.GetLoginUser();
                    obj.CreateTable();


                    obj.GetListItems("Letters Request Forms", lblErr, "LetterRe", "hr");
                    obj.GetListItems("Employee HR Requests Forms", lblErr, "Employee0", "hr");
                    obj.GetListItems("Annual Leave Request Forms", lblErr, "AnnualLe", "hr");

                    obj.GetListItems("Vacation Handover Forms", lblErr, "Vacation", "hr");
                    obj.GetListItems("Back from Vacation Forms", lblErr, "Backfrom", "hr");
                    obj.GetListItems("Exit Permit Forms", lblErr, "ExitPerm", "hr");
                    obj.GetListItems("Sick Leave Forms", lblErr, "SickLeav", "hr");
                    obj.GetListItems("IT Asset Request Forms", lblErr, "ITAssetR", "it");

                    obj.GetListItems("IT Helpdesk Request Forms", lblErr, "ITHelpde", "it");

                    obj.GetListItems("New E-Mail ID Request Forms", lblErr, "NewEMail", "it");
                    obj.GetListItems("Manpower Request Forms", lblErr, "Manpower", "hr");
                    obj.GetListItems("Probation Evaluation Forms", lblErr, "Probatio", "hr");
                    obj.GetListItems("Interview Assessment Forms", lblErr, "Intervie", "hr");
                    obj.GetListItems("IT Asset Transfer Forms", lblErr, "ITAssetT", "it");

                    obj.GetListItems("Purchase Requisition Form", lblErr, "Set_x0020_Workflow", "procurementdepartment");
                    //

                    obj.BindGrid(gv);
                }
                catch (Exception) { }
            });
        }

        protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gv.PageIndex = e.NewPageIndex;
            gv.DataBind();
        }

        protected void gv_RowCreated(object sender, GridViewRowEventArgs e)
        {

        }
    }
}
